package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.InformationEntity;
import com.lx.oms.controller.manager.InformationManager;
import com.lx.oms.controller.service.InformationService;

/**
 * 资讯
 *
 * @author houzhong
 * @date 2018年7月19日 下午12:00:08
 */
@Service("informationService")
public class InformationServiceImpl implements InformationService {

	@Autowired
	private InformationManager informationManager;

	@Override
	public Page<InformationEntity> listInformation(Map<String, Object> params) {
		Query query = new Query(params);
		Page<InformationEntity> page = new Page<>(query);
		informationManager.listInformation(page, query);
		return page;
	}

	@Override
	public R saveInformation(InformationEntity information) {
		int count = informationManager.saveInformation(information);
		return CommonUtils.msg(count);
	}

	@Override
	public R getInformationById(BigInteger id) {
		InformationEntity information = informationManager.getInformationById(id);
		return CommonUtils.msg(information);
	}

	@Override
	public R updateInformation(InformationEntity information) {
		int count = informationManager.updateInformation(information);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = informationManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
